package src;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.InetAddress;
import java.net.Socket;
import java.util.ArrayList;


public class CommRcv implements Runnable {
	Socket rcvSocket;
	BufferedReader socketInput;
	static Main m;
	
	public CommRcv(Socket s, Main m)  {
		rcvSocket = s;
		this.m = m;
		
	}
	public void run() {
		String line;
		try {
			socketInput = new BufferedReader(new InputStreamReader(rcvSocket.getInputStream()));
			
		} 
		
		catch (IOException e) {
			//e.printStackTrace();
		}
		
		while(true) {
			try {
				line = socketInput.readLine();
				if(line != null) { 
					m.parseMsg(line, true);
					System.out.println("Msg recieved: " + line);
					}
				} 	
					
				
			
			catch(IOException e) {
				//e.printStackTrace();
			}
		}
	}

}
